package util;

import graphics.datastructures.BoundingBox;
import graphics.raytracing.Tracable;
import util.Functional.Folder;

public class BoxFolder<T extends Tracable<? extends Tracable<?>>> extends Folder<BoundingBox<T>, BoundingBox<T>> {

	public BoxFolder(BoundingBox<T> acc) {
		super(acc);
	}

	@Override
	public BoundingBox<T> fold(BoundingBox<T> a) {
		for(int i =0;i<3;i++)
		{
			acc.bln()[i]=Math.min(acc.bln()[i], a.bln()[i]);
			acc.rtf()[i]=Math.min(acc.rtf()[i], a.rtf()[i]);
		}
		return acc;
	}
	
}
